<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/page/public/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<title>添加文章</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" href="${ctx}/layui/css/layui.css" media="all" />
<script>  
        <%--JS gloable varilible--%>  
        var ctx = "${ctx}";  
</script>
<style type="text/css">
.layui-form-item .layui-inline {
	width: 33.333%;
	float: left;
	margin-right: 0;
}

@media ( max-width :1240px) {
	.layui-form-item .layui-inline {
		width: 100%;
		float: none;
	}
}
</style>
</head>
<body class="childrenBody">
	<form class="layui-form" style="width: 80%;margin-top: 20px;" id="aaf">

		<div class="layui-form-item">
			<label class="layui-form-label">栏目编号</label>
			<div class="layui-input-block">
				<select name="categoryId">
					<option value="0">请选择</option>
					<c:forEach items="${category}" var="r">
						<option value="${r.id }">${r.name }</option>
					</c:forEach>
				</select>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">标题</label>
			<div class="layui-input-block">
				<input type="text" id="title" class="layui-input userName"
					lay-verify="required" placeholder="请输入标题" name="title" value="">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">文章链接</label>
			<div class="layui-input-block">
				<input type="text" id="link" class="layui-input userName"
					 placeholder="请输入文章链接" name="link" value="">
			</div>
		</div>
		<%--<div class="layui-form-item">--%>
			<%--<label class="layui-form-label">标题颜色</label>--%>
			<%--<div class="layui-input-block">--%>
				<%--<input type="text" id="color" class="layui-input userName"--%>
					<%--lay-verify="required" placeholder="请输入标题颜色" name="color" value="">--%>
			<%--</div>--%>
		<%--</div>--%>
		<div class="layui-form-item">
			<label class="layui-form-label">文章图片</label>
			<div class="layui-input-block">
				<input type="text" id="image" class="layui-input userName"
					lay-verify="required" placeholder="请输入文章图片" name="image" value="">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">关键字</label>
			<div class="layui-input-block">
				<input type="text" id="keywords" class="layui-input userName"
					 placeholder="请输入关键字" name="keywords" value="">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">内容</label>
			<div class="layui-input-block">
				<textarea  id="content" name="content"  style="display: none" ></textarea>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">来源</label>
			<div class="layui-input-block">
				<input type="text" id="copyfrom" class="layui-input userName"
					 placeholder="请输入来源" name="copyfrom" value="">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">描述、摘要</label>
			<div class="layui-input-block">
				<input type="text" id="description" class="layui-input userName"
					 placeholder="请输入描述、摘要" name="description" value="">
			</div>
		</div>
		<%--<div class="layui-form-item">--%>
			<%--<label class="layui-form-label">权重，越大越靠前</label>--%>
			<%--<div class="layui-input-block">--%>
				<%--<input type="text" id="weight" class="layui-input userName"--%>
					 <%--placeholder="请输入权重，越大越靠前" name="weight" value="">--%>
			<%--</div>--%>
		<%--</div>--%>
		<%--<div class="layui-form-item">--%>
			<%--<label class="layui-form-label">权重期限</label>--%>
			<%--<div class="layui-input-block">--%>
				<%--<input type="text" id="weightDate" class="layui-input userName"--%>
					 <%--placeholder="请输入权重期限" name="weightDate" value="">--%>
			<%--</div>--%>
		<%--</div>--%>

		<%--<div class="layui-form-item">--%>
			<%--<label class="layui-form-label">推荐位，多选</label>--%>
			<%--<div class="layui-input-block">--%>
				<%--<input type="text" id="posid" class="layui-input userName"--%>
					<%--lay-verify="required" placeholder="请输入推荐位，多选" name="posid" value="">--%>
			<%--</div>--%>
		<%--</div>--%>
                 <%--<div class="layui-form-item">--%>
			<%--<label class="layui-form-label">自定义内容视图</label>--%>
			<%--<div class="layui-input-block">--%>
				<%--<input type="text" id="customContentView" class="layui-input userName"--%>
					<%--lay-verify="required" placeholder="请输入自定义内容视图" name="customContentView" value="">--%>
			<%--</div>--%>
		<%--</div>--%>
                 <%--<div class="layui-form-item">--%>
			<%--<label class="layui-form-label">视图配置</label>--%>
			<%--<div class="layui-input-block">--%>
				<%--<input type="text" id="viewConfig" class="layui-input userName"--%>
					<%--lay-verify="required" placeholder="请输入视图配置" name="viewConfig" value="">--%>
			<%--</div>--%>
		<%--</div>--%>

		<div class="layui-form-item">
			<label class="layui-form-label">备注信息</label>
			<div class="layui-input-block">
				<input type="text" id="remarks" class="layui-input userName"
					lay-verify="required" placeholder="请输入备注信息" name="remarks" value="">
			</div>
		</div>

				<input type="hidden" id="delFlag"  name="delFlag" value="0">



		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn site-layedit" data-type="content" lay-submit="" lay-filter="addCmsArticle">立即提交</button>
			</div>
		</div>
	</form>
	<script type="text/javascript" src="${ctx}/layui/layui.js"></script>
	<script type="text/javascript" src="${ctx}/page/cmsarticle/addcmsarticle.js"></script>
	<script>
        layui.use('layedit', function(){
            var layedit = layui.layedit
                ,$ = layui.jquery;

            //设置图片上传接口
            layedit.set({
                uploadImage: {
                    url: ctx+'/upload/uploadPic' //上传接口url
                    ,type: 'POST' //默认post
                }
            });
            //构建一个默认的编辑器
            var index = layedit.build('content');

            //编辑器外部操作
            var active = {
                content: function(){
                    //alert(layedit.getContent(index)); //获取编辑器内容
                    layedit.sync(index);
                }
                ,text: function(){
                    alert(layedit.getText(index)); //获取编辑器纯文本内容
                }
                ,selection: function(){
                    alert(layedit.getSelection(index));
                }
            };

            $('.site-layedit').on('click', function(){
                var type = $(this).data('type');
                active[type] ? active[type].call(this) : '';
            });


        });
	</script>

</body>
</html>